package com.googlecode.gwtbb.client.only.remote;

import com.googlecode.gwtbb.client.shared.entity.user.User;

/**
 * @author Abraham Grief
 * @version $Id$
 * @since Apr 17, 2008
 */
public class ClientSession {
	private String sessionId;
	private User user;

	public String getSessionId() {
		return sessionId;
	}

	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User gwtbbUser) {
		this.user = gwtbbUser;
	}

	public boolean isLoggedOut() {
		return sessionId == null || user == null;
	}

	public boolean isLoggedIn() {
		return sessionId != null && user != null;
	}

	public Long getUserId() {
		return isLoggedIn() ? user.getId() : null;
	}
}
